package config

import (
	"fmt"

	"github.com/spf13/viper"
)

func InitConfig(cfgFile string) {
	if cfgFile == "" {
		cfgFile = "/etc/gcp/sshweb.yaml"
	}
	viper.SetConfigFile(cfgFile)

	viper.AutomaticEnv()
	viper.WatchConfig()

	if err := viper.ReadInConfig(); err == nil {
		fmt.Println("Using config file:", viper.ConfigFileUsed())
	}
}
